package org.jeecg.modules.openwx;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.*;

import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;


/**
 * @version 1.0
 * @date 创建时间：2019年3月6日 下午4:29:13
 */
public class Xml2MapUtil {
    public static Map<String, String> Dom2Map(String xml) throws Exception{
        Document doc = DocumentHelper.parseText(xml);
        Map<String, String> map = new HashMap<String, String>();
        if(doc == null)
            return map;
        Element root = doc.getRootElement();
        for (Iterator iterator = root.elementIterator(); iterator.hasNext();) {
            Element e = (Element) iterator.next();
            List list = e.elements();
            map.put(e.getName(), e.getText());
        }
        return map;
    }
}
